import request from '@/utils/request'

// 查询参数列表
export function procConfig(query) {
  return request({
    url: '/procurement/list',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: JSON.stringify(query)
  })
}

// 查询参数详细
export function getConfig(configId) {
  return request({
    url: '/procurement/getStoById/' + configId,
    method: 'get'
  })
}

// 根据参数键名查询参数值
export function getConfigKey(configKey) {
  return request({
    url: '/system/config/configKey/' + configKey,
    method: 'get'
  })
}

// 新增采购清单
export function addConfig(data) {
  return request({
    url: '/procurement',
    method: 'post',
    data: JSON.stringify(data)
  })
}

// 修改采购清单
export function updateConfig(data) {
  return request({
    url: '/procurement',
    method: 'put',
    data: JSON.stringify(data)
  })
}

// 删除参数配置
export function delConfig(configId) {
  return request({
    url: '/procurement/' + configId,
    method: 'delete'
  })
}

// 刷新参数缓存
export function refreshCache() {
  return request({
    url: '/system/config/refreshCache',
    method: 'delete'
  })
}

//获取商品明细
export function queryGoodsList(query) {
  return request({
    url:'/OrderDetail/list',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: JSON.stringify(query)
  })
}
  //新增入库申请
  export function applyStorage(query) {
    return request({
      url: '/insto',
      method: 'Put',
      headers: {
      'Content-Type': 'application/json'
      },
      data:JSON.stringify(query)
    })
}
//新增物品详情
export function addOrderDetail(query) {
  return request({
    url: '/OrderDetail',
    method:'Put',
    headers: {
      'Content-Type': 'application/json'
      },
    data:JSON.stringify(query)
    })
  }
//修改物品详情
export function updateOrederDetail(query) {
  return request({
    url: '/OrderDetail',
    method: 'Post',
    headers: {
      'Content-Type': 'application/json'
      },
    data:JSON.stringify(query)
  })
}
//删除商品详情
export function delOrderDetail(query) {
  return request({
    url: '/OrderDetail/del',
    method: 'Post',
    headers: {
      'Content-Type': 'application/json'
      },
    data:JSON.stringify(query)
  })
}
//获取最大订单编号
export function gerMaxStoProId() {
  return request({
    url: '/procurement/maxId',
    method:'Get',
  })
}